/**
 * Created by Administrator on 2017/8/8.
 */


import React,{Component} from 'react'
import {View, Text, TouchableOpacity, Image ,StyleSheet} from 'react-native'
import {NavigationActions} from 'react-navigation'
import StorageUtils from '../Storage/StorageUtil'

let right_back = require('../Img/icon_right_bcck.png')

export default class Setting extends Component{

    static navigationOptions = ({navigation}) => ({

    })

    render(){
        return(
            <View>
                <TouchableOpacity style={styles.ll}>
                    <Text style={styles.text}>关于</Text>
                    <Image style={styles.img} source={right_back}/>
                </TouchableOpacity>
                <View style={styles.divider}></View>
                <TouchableOpacity style={styles.ll}>
                    <Text style={styles.text}>联系我们</Text>
                    <Image style={styles.img} source={right_back}/>
                </TouchableOpacity>
                <View style={styles.divider}></View>
                <TouchableOpacity style={styles.ll}>
                    <Text style={styles.text}>版本信息</Text>
                    <Image style={styles.img} source={right_back}/>
                </TouchableOpacity>
                <View style={styles.divider}></View>
                <TouchableOpacity style={styles.ll}>
                    <Text style={styles.text}>检查更新</Text>
                    <Image style={styles.img} source={right_back}/>
                </TouchableOpacity>
                <TouchableOpacity style={styles.exit_ll}
                                  onPress={()=>{
                                      StorageUtils._remove('loginresult')
                                      this.props.navigation.dispatch(resetLoginActions)
                                  }}>
                    <Text style={styles.exit_tv}>退出登录</Text>
                </TouchableOpacity>
            </View>
        )
    }
}

const resetLoginActions = NavigationActions.reset({
    index:0,
    actions:[
        NavigationActions.navigate({routeName:'Login'})
    ]
})

const styles = StyleSheet.create({

    ll:{
        height:50,
        width:'100%',
        flexDirection:'row',
        justifyContent:'space-between',
        backgroundColor:'#fff',
        alignItems:'center'
    },
    divider:{
        height:0.5,
        backgroundColor:'#cfcfcf',
        marginRight:16,
        marginLeft:16
    },
    text:{
        fontSize:14,
        color:'#222',
        marginLeft:16
    },
    img:{
        marginRight:16,
        width:15,
        height:22,
        resizeMode:'center'
    },
    exit_ll:{
        alignSelf:'center',
        marginTop:120,
        width:180,
        height:45,
        borderRadius:22.5,
        backgroundColor:'#ff231e',
        alignItems:'center',
        justifyContent:'center'
    },
    exit_tv:{
        fontSize:16,
        color:'#fff'
    }
})